#include "mjson.h"
#include <string.h>


void get_obj_mem_int(json_object *new_object,const char *field, int *obj_val)
{
	struct json_object *object = json_object_object_get(new_object,field);


	*obj_val = json_object_get_int(object);
	
	json_object_put(object);
}


void get_obj_mem_string(json_object *new_object,const char *field,char *obj_val)
{

	struct json_object *json = json_object_object_get(new_object,field);

	//json_object_object_get_ex(new_object,field,&json);

//	obj_val =(char*)json_object_get_string(json);

	memcpy(obj_val,json_object_get_string(json),sizeof(json_object_get_string(json)));
	
	json_object_put(json);
}

void get_obj_mem_object(json_object *new_object,const char *field,json_object *obj_val)
{
	struct json_object *object = json_object_object_get(new_object,field);

//	obj_val = (json_object*)json_object_get_object(object);

	memcpy(obj_val,(const char*)object,sizeof(object));
	
	json_object_put(object);
}








